<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/base.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>新建课时</title>

	<link rel="stylesheet" href="${ctximg}/static/common/jquery-ui-1.10.4/css/ui-lightness/jquery-ui-1.10.4.custom.css"/>
	<script src="${ctximg}/static/common/jquery-ui-1.10.4/js/jquery-ui-1.10.4.custom.js?v=${v}"></script>
	<script src="${ctximg}/static/common/jquery-ui-1.10.4/js/jquery.ui.datepicker-zh-CN.js?v=${v}"></script>
	<script type="text/javascript" src="${ctximg}/static/common/jquery-ui-1.10.4/js/jquery-ui-timepicker-addon.js?v=${v}"></script>
	<script type="text/javascript" src="${ctximg}/static/common/jquery-ui-1.10.4/js/jquery-ui-timepicker-zh-CN.js?v=${v}"></script>

	<script type="text/javascript">
		$(function() {

			//时间插件
			$("#beginTime,#endTime").datetimepicker(
					{regional:"zh-CN",
						changeMonth: true,
						dateFormat:"yy-mm-dd ",
						timeFormat: "HH:mm:ss",
						autoclose:true
					});
		});

		function addCourseKpoint() {
			if($.trim($("#kpointName").val())==""){
				alert("请输入课时名称");
				return;
			}
			var beginTime = $("#beginTime").val();
			var endTime = $("#endTime").val();
			if(beginTime >= endTime) {
				alert("开始时间必须小于结束时间");
				return;
			}
			$.ajax({
				url : "${ctx}/admin/course/live/kpoint/add",
				type : "post",
				data:{
					"courseLiveKpoint.courseId":$("#courseId").val(),
					"courseLiveKpoint.kpointName": $.trim($("#kpointName").val()),
					"courseLiveKpoint.beginTime":$("#beginTime").val(),
					"courseLiveKpoint.endTime":$("#endTime").val(),
				},
				async : false,
				success : function(data) {
					if (data.success == true) {
						alert("添加成功");
						window.location.href='${ctx}/admin/course/live/kpoint/list/' + $("#courseId").val();
					} else {
						alert("添加失败");
					}
				}
			});
		}
	</script>
</head>
<body >
	<input id="courseId" type="hidden" name="courseLiveKpoint.courseId" value="${courseId}" />
	<div class="page_head">
		<h4>
			<em class="icon14 i_01"></em> &nbsp; <span>直播课时管理</span> &gt; <span>新建直播课时</span>
		</h4>
	</div>
	<!-- /tab4 begin -->
	<div class="mt20">
		<div class="commonWrap">
			<table width="100%" cellspacing="0" cellpadding="0" border="0" class="commonTab01">
				<thead>
				<tr>
					<th align="left" colspan="2"><span> 课时基本属性 <tt class="c_666 ml20 fsize12">
						（ <font color="red">*</font> &nbsp;为必填项）
					</tt>
							</span></th>
				</tr>
				</thead>
				<tbody>
				<tr>
					<td align="center"><font color="red">*</font> &nbsp;课时名称</td>
					<td><input type="text" id="kpointName" name="courseLiveKpoint.kpointName" class="required "  /></td>
				</tr>
				<tr class="showLive">
					<td width="20%" align="center"><font color="red">*</font> &nbsp;直播开始时间</td>
					<td><input id="beginTime" type="text" name="courseLiveKpoint.beginTime" readonly="readonly" class="required " value="" /></td>
				</tr>
				<tr class="showLive">
					<td width="20%" align="center"><font color="red">*</font> &nbsp;直播结束时间</td>
					<td><input id="endTime" type="text" name="courseLiveKpoint.endTime" readonly="readonly" class="required " /></td>
				</tr>
				<tr>
					<td align="center" colspan="2"><a class="btn btn-danger" title="提 交" href="javascript:addCourseKpoint()">提 交</a> <a
							class="btn btn-danger" title="返 回" href="javascript:history.go(-1);">返 回</a></td>
				</tr>
				</tbody>
			</table>
		</div>
	</div>
	<!-- /tab4 end -->
</body>
</html>
